package com.example.zhangxin.comevedio.activity.activity;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.WindowManager;

import com.example.zhangxin.comevedio.activity.MyApplication;

public abstract class BaseActivity extends FragmentActivity {

    private int layout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        setContentView(getLayout());
        //一键删除的添加
        MyApplication.addActivity(this);
        //显示正在刷新的dialog
//        mLoading = DialogUtlis.createLoadingDialog(this);
        // 找控件
        findView();
        //设置数据
        setData();
        // 设置监听
        setListener();
    }

    //获取要加载的布局
    public abstract int getLayout();

    //找控件
    public abstract void findView();

    //设置数据
    public abstract void setData();

    //设置监听
    public abstract void setListener();

    @Override
    protected void onDestroy() {
        //销毁时从集合移除
        MyApplication.removeActivity(this);
        super.onDestroy();
    }
}
